#packages 
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.0.2
## ── Attaching packages ──────────────────────────────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.2     ✓ purrr   0.3.4
## ✓ tibble  3.0.1     ✓ dplyr   1.0.1
## ✓ tidyr   1.1.1     ✓ stringr 1.4.0
## ✓ readr   1.3.1     ✓ forcats 0.5.0
## Warning: package 'ggplot2' was built under R version 4.0.2
## Warning: package 'tidyr' was built under R version 4.0.2
## Warning: package 'readr' was built under R version 4.0.2
## Warning: package 'dplyr' was built under R version 4.0.2
## Warning: package 'forcats' was built under R version 4.0.2
## ── Conflicts ─────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(ggplot2)

library(sf)
## Warning: package 'sf' was built under R version 4.0.2
## Linking to GEOS 3.8.1, GDAL 3.1.1, PROJ 6.3.1
library(rmapshaper)
## Warning: package 'rmapshaper' was built under R version 4.0.2
## Registered S3 method overwritten by 'geojsonlint':
##   method         from 
##   print.location dplyr
library(kableExtra)
## Warning: package 'kableExtra' was built under R version 4.0.2
## 
## Attaching package: 'kableExtra'
## The following object is masked from 'package:dplyr':
## 
##     group_rows
library(readxl)
## Warning: package 'readxl' was built under R version 4.0.2

Question 1

#Create conus counties and county centroid (1.1 and 1.2)

USAboundaries::us_counties() %>%
  filter(!state_name %in% c("Alaska", "Hawaii", "Puerto Rico")) %>%
  st_transform(5070) ->
  counties

st_centroid(counties) %>%
  st_union() ->
  cent_counties
## Warning in st_centroid.sf(counties): st_centroid assumes attributes are constant
## over geometries of x

#Tessellation and coverage (1.3 and 1.4)

#voronoi tessellation
st_voronoi(cent_counties) %>%
  st_cast() %>%
  st_as_sf() %>%
  mutate(id = 1:n()) ->
  v_grid

st_intersection(v_grid, st_union(counties)) ->
  v_grid
## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries
mapview::npts(v_grid)
## [1] 24858
rmapshaper::ms_simplify(v_grid, keep = .01) ->
  v_grid_simp

mapview::npts(v_grid_simp)
## [1] 21567
#triangulated tessellation
st_triangulate(cent_counties) %>%
  st_cast() %>%
  st_as_sf() %>%
  mutate(id = 1:n()) ->
  t_grid

st_intersection(t_grid, st_union(counties)) ->
  t_grid
## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries
mapview::npts(t_grid)
## [1] 28800
rmapshaper::ms_simplify(t_grid, keep = .01) ->
  t_grid_simp

mapview::npts(t_grid_simp)
## [1] 26011
#grid coverage
st_make_grid(counties, n = c(70, 50)) %>%
  st_as_sf() %>%
  mutate(id = 1:n()) ->
  sq_grid
#hex coverage
st_make_grid(counties, n = c(70, 50), square = FALSE) %>%
  st_as_sf() %>%
  mutate(id = 1:n()) ->
  hex_grid

#Create a function (1.6)

#ggplot function
plot_tess = function(data, title){
  ggplot() +
    geom_sf(data = data, fill = "white", col = "navy", size = .2) +
    theme_void() +
    labs(title = title, caption = paste("This tesselation has:", nrow(data), "tiles" ))
}

#Plot (1.7)

#original county data 
plot_tess(counties, "counties")

#grid coverage 
plot_tess(sq_grid, "square grid coverage")

#hex coverage
plot_tess(hex_grid, "hexagonal grid coverage")

#voronoi 
plot_tess(v_grid_simp, "voronoi tessellation")

#triangulated
plot_tess(t_grid_simp, "triangulated tessellation")

Question 2

#create a function to summarize tessellations

tess_features = function(data, title){
  df = data.frame(row.names = title,
                  mean_area = units::set_units((st_area(data)), "km^2") %>%
                    units::drop_units() %>%
                    head(n = 1),
                  total_area = units::set_units((sum(st_area(data))), "km^2") %>%
                    units::drop_units() %>%
                    head(n = 1),
                  n_features = count(data, "id") %>%
                    st_drop_geometry() %>%
                    select(n),
                  standard_dev = sd(st_area(data)))
  return(df)
}
#2.2
tess_features(counties, "original counties summary")
##                           mean_area total_area    n standard_dev
## original counties summary  1157.884    7837583 3108   3404325220
tess_features(sq_grid, "square grid summary")
##                     mean_area total_area    n standard_dev
## square grid summary  3819.376    8563041 2242  1.45713e-05
tess_features(hex_grid, "hexagonal grid summary")
##                        mean_area total_area    n standard_dev
## hexagonal grid summary  3763.052    8545891 2271 1.413761e-05
tess_features(v_grid_simp, "voronoi tessellation summary")
##                              mean_area total_area    n standard_dev
## voronoi tessellation summary  3946.585    7822549 3105   2891630506
tess_features(t_grid_simp, "triangulated tessellation summary")
##                                   mean_area total_area    n standard_dev
## triangulated tessellation summary  674.9631    7754447 6196   1578538715
#2.3 
tess_summary = bind_rows(
  tess_features(counties, "original counties summary"), 
  tess_features(sq_grid, "square grid summary"), 
  tess_features(hex_grid, "hexagonal grid summary"), 
  tess_features(v_grid_simp, "voronoi tessellation summary"), 
  tess_features(t_grid_simp, "triangulated tessellation summary"))
#table with the five summaries (2.4)
knitr::kable(tess_summary,
             caption = "Tessellation Summary",
             col.names = c("Mean Area in km^2", "Total Area in km^2", "Number of Features", "Standard Deviation")) %>%
  kable_styling(bootstrap_options = "striped", font_size = 15)
Tessellation Summary
Mean Area in km^2 Total Area in km^2 Number of Features Standard Deviation
original counties summary 1157.8837 7837583 3108 3.404325e+09
square grid summary 3819.3758 8563041 2242 1.460000e-05
hexagonal grid summary 3763.0520 8545891 2271 1.410000e-05
voronoi tessellation summary 3946.5852 7822549 3105 2.891631e+09
triangulated tessellation summary 674.9631 7754447 6196 1.578539e+09

#comment on the traits of each tessellation (2.5)

-Square grid and hexagonal grid has the least amount of features since they are both pretty simple, easy to assemble and equally spread out. Hexagonal grid would be better for mapping large areas since it fits curve surface better.

-The voronoi tessellation and triangulated tessellation above are both simplified. The voronoi tessellation is the most similar to the original counties coverage. Triangulated tessellation has the most amount of features but is more accurate.

##Question 3

#loading dam data (3.1)
read_excel("~/github/geog-176A-labs/data/NID2019_U.xlsx") %>%
  filter(!is.na(LATITUDE)) %>%
  st_as_sf(coords = c("LONGITUDE", "LATITUDE"), crs = 4326) %>%
  st_transform(5070) %>%
  st_filter(counties) ->
  NID
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E5298 / R5298C5: got '10.027'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E5561 / R5561C5: got '7000.141'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E5562 / R5562C5: got '7000.142'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31773 / R31773C5: got '161'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31774 / R31774C5: got '57'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31775 / R31775C5: got '651'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31776 / R31776C5: got '409'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31777 / R31777C5: got '162'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31778 / R31778C5: got '523'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31779 / R31779C5: got '524'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31785 / R31785C5: got '458'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31795 / R31795C5: got '13'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31796 / R31796C5: got '636'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31797 / R31797C5: got '4'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31798 / R31798C5: got '633'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31801 / R31801C5: got '69'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31802 / R31802C5: got '568'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31803 / R31803C5: got '62'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31804 / R31804C5: got '60'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31806 / R31806C5: got '85'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31807 / R31807C5: got '850'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31808 / R31808C5: got '20'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31809 / R31809C5: got '369'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31810 / R31810C5: got '125'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31815 / R31815C5: got '124'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31816 / R31816C5: got '625'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31817 / R31817C5: got '120'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31818 / R31818C5: got '631'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31819 / R31819C5: got '117'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31820 / R31820C5: got '122'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31836 / R31836C5: got '721'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31838 / R31838C5: got '346'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31839 / R31839C5: got '92'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31840 / R31840C5: got '592'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31841 / R31841C5: got '95'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31842 / R31842C5: got '102'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31843 / R31843C5: got '671'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31844 / R31844C5: got '362'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31850 / R31850C5: got '359'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31854 / R31854C5: got '33'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31855 / R31855C5: got '99'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31856 / R31856C5: got '55'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31857 / R31857C5: got '635'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31858 / R31858C5: got '37'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31859 / R31859C5: got '602'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31860 / R31860C5: got '113'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31861 / R31861C5: got '549'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31862 / R31862C5: got '561'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31863 / R31863C5: got '599'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31864 / R31864C5: got '115'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31866 / R31866C5: got '880'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31868 / R31868C5: got '388'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31869 / R31869C5: got '470'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31871 / R31871C5: got '681'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31872 / R31872C5: got '612'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31878 / R31878C5: got '110'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31880 / R31880C5: got '111'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31881 / R31881C5: got '105'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31882 / R31882C5: got '394'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31883 / R31883C5: got '431'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31884 / R31884C5: got '594'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31885 / R31885C5: got '722'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31887 / R31887C5: got '687'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31889 / R31889C5: got '676'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31891 / R31891C5: got '731'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31892 / R31892C5: got '729'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31893 / R31893C5: got '38'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31894 / R31894C5: got '675'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31896 / R31896C5: got '42'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31897 / R31897C5: got '562'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31898 / R31898C5: got '374'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31899 / R31899C5: got '347'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31900 / R31900C5: got '769'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31901 / R31901C5: got '535'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31902 / R31902C5: got '52'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31903 / R31903C5: got '53'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31904 / R31904C5: got '54'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31905 / R31905C5: got '738'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31906 / R31906C5: got '740'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31907 / R31907C5: got '21'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31908 / R31908C5: got '45'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31909 / R31909C5: got '2'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31910 / R31910C5: got '402'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31911 / R31911C5: got '12'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31912 / R31912C5: got '10'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31913 / R31913C5: got '14'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31915 / R31915C5: got '16.1'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31916 / R31916C5: got '16.2'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31917 / R31917C5: got '597'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31918 / R31918C5: got '17'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31919 / R31919C5: got '533'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31920 / R31920C5: got '534'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31921 / R31921C5: got '428'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31922 / R31922C5: got '15'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31923 / R31923C5: got '586'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31924 / R31924C5: got '127'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31925 / R31925C5: got '41'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31926 / R31926C5: got '559'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31949 / R31949C5: got '579'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31964 / R31964C5: got '140'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31965 / R31965C5: got '147'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31966 / R31966C5: got '135'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31969 / R31969C5: got '142'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31970 / R31970C5: got '137'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31971 / R31971C5: got '139'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31973 / R31973C5: got '708'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31974 / R31974C5: got '656'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31975 / R31975C5: got '641'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31978 / R31978C5: got '536'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31979 / R31979C5: got '537'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31980 / R31980C5: got '131'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31981 / R31981C5: got '70'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31982 / R31982C5: got '507'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31983 / R31983C5: got '27'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31984 / R31984C5: got '538'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31985 / R31985C5: got '404'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31986 / R31986C5: got '399'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31987 / R31987C5: got '400'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31988 / R31988C5: got '839'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31989 / R31989C5: got '156'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31990 / R31990C5: got '84'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31991 / R31991C5: got '688'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31992 / R31992C5: got '844'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31993 / R31993C5: got '893'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31994 / R31994C5: got '804'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E31998 / R31998C5: got '107'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32000 / R32000C5: got '689'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32001 / R32001C5: got '109'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32002 / R32002C5: got '818'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32003 / R32003C5: got '9'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32004 / R32004C5: got '773'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32005 / R32005C5: got '864.2'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32007 / R32007C5: got '81.1'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32008 / R32008C5: got '81.2'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32009 / R32009C5: got '77'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32010 / R32010C5: got '807'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32011 / R32011C5: got '810'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32015 / R32015C5: got '30'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32016 / R32016C5: got '31'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32017 / R32017C5: got '26'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32018 / R32018C5: got '802'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32019 / R32019C5: got '98'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32020 / R32020C5: got '410'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32021 / R32021C5: got '627'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32023 / R32023C5: got '727'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32024 / R32024C5: got '357'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32025 / R32025C5: got '356'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32026 / R32026C5: got '539'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32027 / R32027C5: got '149'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32028 / R32028C5: got '415.1'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32029 / R32029C5: got '848'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32030 / R32030C5: got '845'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32031 / R32031C5: got '797'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32032 / R32032C5: got '72'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32033 / R32033C5: got '650'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32034 / R32034C5: got '441'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32035 / R32035C5: got '61'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32036 / R32036C5: got '163'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32037 / R32037C5: got '96'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32038 / R32038C5: got '65'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32039 / R32039C5: got '530'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32040 / R32040C5: got '114'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32042 / R32042C5: got '739'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32043 / R32043C5: got '349'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32044 / R32044C5: got '888'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32046 / R32046C5: got '829'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32047 / R32047C5: got '591'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32048 / R32048C5: got '46'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32049 / R32049C5: got '792'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32050 / R32050C5: got '364'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32051 / R32051C5: got '610'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32052 / R32052C5: got '563'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32053 / R32053C5: got '160'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32054 / R32054C5: got '647'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32055 / R32055C5: got '134'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32056 / R32056C5: got '143'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32057 / R32057C5: got '141'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32058 / R32058C5: got '398'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32059 / R32059C5: got '396'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32061 / R32061C5: got '29'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32062 / R32062C5: got '47'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32063 / R32063C5: got '517'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32064 / R32064C5: got '3'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32065 / R32065C5: got '64'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32066 / R32066C5: got '569'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32067 / R32067C5: got '557'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32068 / R32068C5: got '679'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32069 / R32069C5: got '630'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32070 / R32070C5: got '101'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32071 / R32071C5: got '603'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32072 / R32072C5: got '634'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32073 / R32073C5: got '706'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32074 / R32074C5: got '68'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32075 / R32075C5: got '373'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32077 / R32077C5: got '383'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32078 / R32078C5: got '56'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32079 / R32079C5: got '516'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32080 / R32080C5: got '432'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32081 / R32081C5: got '63'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32083 / R32083C5: got '6'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32084 / R32084C5: got '5'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32085 / R32085C5: got '24'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32086 / R32086C5: got '103'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32087 / R32087C5: got '112'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32088 / R32088C5: got '856.1'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32089 / R32089C5: got '89'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32090 / R32090C5: got '854'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32091 / R32091C5: got '908'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32092 / R32092C5: got '734'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32093 / R32093C5: got '911'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32094 / R32094C5: got '917'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32095 / R32095C5: got '88'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32096 / R32096C5: got '770'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32097 / R32097C5: got '768'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32098 / R32098C5: got '705'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32099 / R32099C5: got '118'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32100 / R32100C5: got '119'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32101 / R32101C5: got '360'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32102 / R32102C5: got '411'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32103 / R32103C5: got '598'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32104 / R32104C5: got '67'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32105 / R32105C5: got '116'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32106 / R32106C5: got '59'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32108 / R32108C5: got '157'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32109 / R32109C5: got '442'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32110 / R32110C5: got '58'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32111 / R32111C5: got '857'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32112 / R32112C5: got '526'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32113 / R32113C5: got '871'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32114 / R32114C5: got '891'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32115 / R32115C5: got '583'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32116 / R32116C5: got '733'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32117 / R32117C5: got '815'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32118 / R32118C5: got '707'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32119 / R32119C5: got '887'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32120 / R32120C5: got '886'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32121 / R32121C5: got '846'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32122 / R32122C5: got '542'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32123 / R32123C5: got '889'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32124 / R32124C5: got '593'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32125 / R32125C5: got '79'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32126 / R32126C5: got '76'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32127 / R32127C5: got '817'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32128 / R32128C5: got '75'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32129 / R32129C5: got '584'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32130 / R32130C5: got '813'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32131 / R32131C5: got '93'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32132 / R32132C5: got '903'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32133 / R32133C5: got '812'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32134 / R32134C5: got '838'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32135 / R32135C5: got '358'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32136 / R32136C5: got '686'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32137 / R32137C5: got '682'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32138 / R32138C5: got '879'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32139 / R32139C5: got '690'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32140 / R32140C5: got '613'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32141 / R32141C5: got '814'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32142 / R32142C5: got '136'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32143 / R32143C5: got '133'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32144 / R32144C5: got '653'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32145 / R32145C5: got '406'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32146 / R32146C5: got '148'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32147 / R32147C5: got '150'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32148 / R32148C5: got '151'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32149 / R32149C5: got '659'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32150 / R32150C5: got '494'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32151 / R32151C5: got '1'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32152 / R32152C5: got '496'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32153 / R32153C5: got '883'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32154 / R32154C5: got '661'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32155 / R32155C5: got '658'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32156 / R32156C5: got '144'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32157 / R32157C5: got '138'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32158 / R32158C5: got '660'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32159 / R32159C5: got '154'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32160 / R32160C5: got '152'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32161 / R32161C5: got '146'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32162 / R32162C5: got '553'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32163 / R32163C5: got '798'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32164 / R32164C5: got '87'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32166 / R32166C5: got '35'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32168 / R32168C5: got '691'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32169 / R32169C5: got '728'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32170 / R32170C5: got '858'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32171 / R32171C5: got '796'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32172 / R32172C5: got '841'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32173 / R32173C5: got '865'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32174 / R32174C5: got '808'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32175 / R32175C5: got '861'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32176 / R32176C5: got '540'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32177 / R32177C5: got '788'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32178 / R32178C5: got '779'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32179 / R32179C5: got '776'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32180 / R32180C5: got '835'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32181 / R32181C5: got '789'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32182 / R32182C5: got '890'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32183 / R32183C5: got '782'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32187 / R32187C5: got '525'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32188 / R32188C5: got '654'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32189 / R32189C5: got '73'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32190 / R32190C5: got '783'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32191 / R32191C5: got '66'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32192 / R32192C5: got '543'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32193 / R32193C5: got '720'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32194 / R32194C5: got '71'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32195 / R32195C5: got '632'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32196 / R32196C5: got '667'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32197 / R32197C5: got '588'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32198 / R32198C5: got '878'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32199 / R32199C5: got '611'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32200 / R32200C5: got '556'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32201 / R32201C5: got '546'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32202 / R32202C5: got '382'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32203 / R32203C5: got '106'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32204 / R32204C5: got '621'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32205 / R32205C5: got '806'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32206 / R32206C5: got '104'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32207 / R32207C5: got '832'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32209 / R32209C5: got '816'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32210 / R32210C5: got '833'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32211 / R32211C5: got '821'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32212 / R32212C5: got '831'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32214 / R32214C5: got '43'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32215 / R32215C5: got '882'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32216 / R32216C5: got '639'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32217 / R32217C5: got '640'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32218 / R32218C5: got '637'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32219 / R32219C5: got '756'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32221 / R32221C5: got '693'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32222 / R32222C5: got '711'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32224 / R32224C5: got '440'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32230 / R32230C5: got '726'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32231 / R32231C5: got '885'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32232 / R32232C5: got '701'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32233 / R32233C5: got '696'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32234 / R32234C5: got '697'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32236 / R32236C5: got '158'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32237 / R32237C5: got '730'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32238 / R32238C5: got '704'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32239 / R32239C5: got '515'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32240 / R32240C5: got '680'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32241 / R32241C5: got '820'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32242 / R32242C5: got '108'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32243 / R32243C5: got '819'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32244 / R32244C5: got '828'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32245 / R32245C5: got '929'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32246 / R32246C5: got '565'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32247 / R32247C5: got '801'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32248 / R32248C5: got '380'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32249 / R32249C5: got '827'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32250 / R32250C5: got '618'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32251 / R32251C5: got '22'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32252 / R32252C5: got '805'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32253 / R32253C5: got '714'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32254 / R32254C5: got '867'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32255 / R32255C5: got '837'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32256 / R32256C5: got '34'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32257 / R32257C5: got '36'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32258 / R32258C5: got '547'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32259 / R32259C5: got '548'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32260 / R32260C5: got '678'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32261 / R32261C5: got '852'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32262 / R32262C5: got '466.1'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32263 / R32263C5: got '946'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32264 / R32264C5: got '737'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32265 / R32265C5: got '285'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32266 / R32266C5: got '873'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32267 / R32267C5: got '649'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32268 / R32268C5: got '856.2'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32269 / R32269C5: got '847'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32270 / R32270C5: got '744'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32271 / R32271C5: got '474'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32273 / R32273C5: got '232'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32274 / R32274C5: got '931'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32275 / R32275C5: got '361'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32276 / R32276C5: got '1006'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32277 / R32277C5: got '999'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32278 / R32278C5: got '823'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32279 / R32279C5: got '1011'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32288 / R32288C5: got '299'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32289 / R32289C5: got '193'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32290 / R32290C5: got '324'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32291 / R32291C5: got '864.1'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32292 / R32292C5: got '200'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32293 / R32293C5: got '231'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32294 / R32294C5: got '239'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32295 / R32295C5: got '849'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32296 / R32296C5: got '170'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32297 / R32297C5: got '175.1'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32298 / R32298C5: got '175.2'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32299 / R32299C5: got '198'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32300 / R32300C5: got '288'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32301 / R32301C5: got '290'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32302 / R32302C5: got '252'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32303 / R32303C5: got '219'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32304 / R32304C5: got '245'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32305 / R32305C5: got '236'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32306 / R32306C5: got '301'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32307 / R32307C5: got '242'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32308 / R32308C5: got '238.1'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32309 / R32309C5: got '237.1'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32310 / R32310C5: got '254'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32311 / R32311C5: got '265'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32312 / R32312C5: got '294'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32313 / R32313C5: got '341'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32314 / R32314C5: got '259'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32316 / R32316C5: got '220'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32317 / R32317C5: got '305'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32320 / R32320C5: got '335'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32323 / R32323C5: got '169'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32324 / R32324C5: got '165'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32325 / R32325C5: got '282'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32326 / R32326C5: got '281'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32327 / R32327C5: got '283'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32328 / R32328C5: got '284'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32329 / R32329C5: got '202'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32330 / R32330C5: got '318'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32331 / R32331C5: got '315'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32332 / R32332C5: got '271'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32333 / R32333C5: got '273'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32334 / R32334C5: got '330'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32335 / R32335C5: got '166'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32336 / R32336C5: got '345'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32338 / R32338C5: got '261'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32339 / R32339C5: got '319'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32340 / R32340C5: got '326'
## Warning in read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, :
## Expecting logical in E32341 / R32341C5: got '348'
#point-in-polygon function (3.2)
point_in_polygon = function(points, polygon, group){
  st_join(polygon, points) %>%
    st_drop_geometry() %>%
    count(get(group)) %>%
    setNames(c(group, "n")) %>%
    left_join(polygon, by = group) %>%
    st_as_sf()
}
#apply PIP to five tessellations (3.3)
point_in_polygon(NID, counties, "name")
## Simple feature collection with 3108 features and 13 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: -2356114 ymin: 268660.9 xmax: 2258154 ymax: 3165722
## projected CRS:  NAD83 / Conus Albers
## First 10 features:
##         name   n statefp countyfp countyns       affgeoid geoid lsad      aland
## 1  Abbeville  24      45      001 01245666 0500000US45001 45001   06 1270343695
## 2     Acadia   2      22      001 00558389 0500000US22001 22001   15 1696777754
## 3   Accomack  14      51      001 01480091 0500000US51001 51001   06 1163701471
## 4        Ada  17      16      001 00395066 0500000US16001 16001   06 2726012203
## 5      Adair 130      19      001 00465190 0500000US19001 19001   06 1474404199
## 6      Adair 130      29      001 00765805 0500000US29001 29001   06 1469362053
## 7      Adair 130      40      001 01101788 0500000US40001 40001   06 1485305064
## 8      Adair 130      21      001 00516847 0500000US21001 21001   06 1049678094
## 9      Adams 317      18      001 00450401 0500000US18001 18001   06  878079482
## 10     Adams 317      55      001 01581060 0500000US55001 55001   06 1672140739
##        awater     state_name state_abbr jurisdiction_type
## 1    53120004 South Carolina         SC             state
## 2     6021519      Louisiana         LA             state
## 3  2229281547       Virginia         VA             state
## 4    20852173          Idaho         ID             state
## 5     2597996           Iowa         IA             state
## 6     5468507       Missouri         MO             state
## 7     9254749       Oklahoma         OK             state
## 8    18430783       Kentucky         KY             state
## 9     2429955        Indiana         IN             state
## 10  108432131      Wisconsin         WI             state
##                          geometry
## 1  MULTIPOLYGON (((1209057 132...
## 2  MULTIPOLYGON (((322657.5 82...
## 3  MULTIPOLYGON (((1742058 179...
## 4  MULTIPOLYGON (((-1631173 24...
## 5  MULTIPOLYGON (((107649.6 20...
## 6  MULTIPOLYGON (((264766.1 19...
## 7  MULTIPOLYGON (((107218.6 14...
## 8  MULTIPOLYGON (((920099.5 16...
## 9  MULTIPOLYGON (((910768.6 20...
## 10 MULTIPOLYGON (((476461.4 23...
point_in_polygon(NID, v_grid_simp, "id")
## Simple feature collection with 3105 features and 2 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: -2353992 ymin: 311291.1 xmax: 2258154 ymax: 3159925
## projected CRS:  NAD83 / Conus Albers
## First 10 features:
##    id  n                              x
## 1   1 25 MULTIPOLYGON (((-2258812 20...
## 2   2 53 MULTIPOLYGON (((-2322627 21...
## 3   3 20 MULTIPOLYGON (((-2336657 22...
## 4   4  3 MULTIPOLYGON (((-2304825 23...
## 5   5  2 MULTIPOLYGON (((-2285409 25...
## 6   6 19 MULTIPOLYGON (((-2307718 20...
## 7   7  3 MULTIPOLYGON (((-2256783 19...
## 8   8 64 MULTIPOLYGON (((-2275126 20...
## 9   9  6 MULTIPOLYGON (((-2258518 22...
## 10 10 24 MULTIPOLYGON (((-2290318 19...
point_in_polygon(NID, t_grid_simp, "id")
## Simple feature collection with 6196 features and 2 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: -2303763 ymin: 344857.6 xmax: 2200721 ymax: 3127770
## projected CRS:  NAD83 / Conus Albers
## First 10 features:
##    id  n                              x
## 1   1  1 MULTIPOLYGON (((-2172542 27...
## 2   2  8 MULTIPOLYGON (((-2115480 29...
## 3   3  6 MULTIPOLYGON (((-2125240 28...
## 4   4  1 MULTIPOLYGON (((-2069566 30...
## 5   5  2 MULTIPOLYGON (((-2023436 30...
## 6   6  5 MULTIPOLYGON (((-1994284 31...
## 7   7 19 MULTIPOLYGON (((-1976943 31...
## 8   8  7 MULTIPOLYGON (((-1889498 31...
## 9   9  9 MULTIPOLYGON (((-1889498 31...
## 10 10 23 MULTIPOLYGON (((-1889498 31...
point_in_polygon(NID, sq_grid, "id")
## Simple feature collection with 2242 features and 2 fields
## geometry type:  POLYGON
## dimension:      XY
## bbox:           xmin: -2356114 ymin: 268660.9 xmax: 2258154 ymax: 3165722
## projected CRS:  NAD83 / Conus Albers
## First 10 features:
##    id  n                              x
## 1   1  2 POLYGON ((-180815.9 268660....
## 2   2  1 POLYGON ((1401219 268660.9,...
## 3   3  1 POLYGON ((1467137 268660.9,...
## 4   4  1 POLYGON ((1533055 268660.9,...
## 5   5  1 POLYGON ((-378570.2 326602....
## 6   6 13 POLYGON ((-312652.1 326602....
## 7   7 23 POLYGON ((-246734 326602.1,...
## 8   8 40 POLYGON ((-180815.9 326602....
## 9   9  1 POLYGON ((1467137 326602.1,...
## 10 10  1 POLYGON ((1533055 326602.1,...
point_in_polygon(NID, hex_grid, "id")
## Simple feature collection with 2271 features and 2 fields
## geometry type:  POLYGON
## dimension:      XY
## bbox:           xmin: -2389073 ymin: 230603 xmax: 2291113 ymax: 3218144
## projected CRS:  NAD83 / Conus Albers
## First 10 features:
##    id  n                              x
## 1   1  2 POLYGON ((-2356114 2057379,...
## 2   2  1 POLYGON ((-2356114 2171553,...
## 3   3  1 POLYGON ((-2356114 2285727,...
## 4   4  1 POLYGON ((-2323155 1886119,...
## 5   5  6 POLYGON ((-2323155 2000293,...
## 6   6 12 POLYGON ((-2323155 2114466,...
## 7   7  1 POLYGON ((-2323155 2228640,...
## 8   8  1 POLYGON ((-2323155 2342813,...
## 9   9  1 POLYGON ((-2323155 2456987,...
## 10 10  1 POLYGON ((-2290196 1714859,...
#function for plotting PIP (3.4)
plot_pip = function(data, title){
  ggplot() +
    geom_sf(data = data, aes(fill = log(n)), col = NA) +
    scale_fill_viridis_b() +
    theme_void() +
    labs(title = title,
         caption = paste("Dams:", sum(data$n)))
}
#plot the five tessellations (3.5)
point_in_polygon(NID, counties, "name") %>%
  plot_pip(., "Dam Locations on Original Counties Coverage")

point_in_polygon(NID, v_grid_simp, "id") %>%
  plot_pip(., "Dam Locations on Voronoi Tessellation")

point_in_polygon(NID, t_grid_simp, "id") %>%
  plot_pip(., "Dam Locations on Triangulated Tessellation")

point_in_polygon(NID, sq_grid, "id") %>%
  plot_pip(., "Dam Locations on Square Grid")

point_in_polygon(NID, hex_grid, "id") %>%
  plot_pip(., "Dam Locations on Hexagonal Grid")

#Comment on the influence of the tessellated surface in the visualization of point counts. How does this related to the MAUP problem. Moving forward you will only use one tessellation, which will you chose and why? (3.6) - Being able to visualize the point counts on different tessellated surfaces show how the object coverage can look significantly different based on how polygons are shown. - MAUP problem is of statistical bias, where data can be interpreted in different ways based on what spatial shape and layout is given. - I would use the hexagonal grid because it’s represented on equal area instead of relying on points for calculating the polygons. Unlike the square grid, it fits curved surfaces better and reduce edge effects.

##Question 4 #The four dam purposes I choose are recreation (R), navigation (N), debris control (D), and water supply(S). I am interested in analyzing dams with recreation as its main purpose because I was surprised by how it is the most common. I am also interested in analyzing dams with navigation, debris control, and water supply as its purpose because I thought they would be more common.

#filtering dam purposes (4.1)
NID %>%
 filter(grepl("S", PURPOSES)) ->
  water_supply

NID %>%
  filter(grepl("R", PURPOSES)) ->
  recreation

NID %>%
  filter(grepl("N", PURPOSES)) ->
  navigation

NID %>%
  filter(grepl("D", PURPOSES)) ->
  debris_control
#apply dam purposes through PIP. My elected tessellation is hexagonal grid. (4.2)
point_in_polygon(water_supply, hex_grid, "id") 
## Simple feature collection with 2271 features and 2 fields
## geometry type:  POLYGON
## dimension:      XY
## bbox:           xmin: -2389073 ymin: 230603 xmax: 2291113 ymax: 3218144
## projected CRS:  NAD83 / Conus Albers
## First 10 features:
##    id  n                              x
## 1   1  2 POLYGON ((-2356114 2057379,...
## 2   2  1 POLYGON ((-2356114 2171553,...
## 3   3  1 POLYGON ((-2356114 2285727,...
## 4   4  1 POLYGON ((-2323155 1886119,...
## 5   5  6 POLYGON ((-2323155 2000293,...
## 6   6 12 POLYGON ((-2323155 2114466,...
## 7   7  1 POLYGON ((-2323155 2228640,...
## 8   8  1 POLYGON ((-2323155 2342813,...
## 9   9  1 POLYGON ((-2323155 2456987,...
## 10 10  1 POLYGON ((-2290196 1714859,...
point_in_polygon(recreation, hex_grid, "id") 
## Simple feature collection with 2271 features and 2 fields
## geometry type:  POLYGON
## dimension:      XY
## bbox:           xmin: -2389073 ymin: 230603 xmax: 2291113 ymax: 3218144
## projected CRS:  NAD83 / Conus Albers
## First 10 features:
##    id n                              x
## 1   1 1 POLYGON ((-2356114 2057379,...
## 2   2 1 POLYGON ((-2356114 2171553,...
## 3   3 1 POLYGON ((-2356114 2285727,...
## 4   4 1 POLYGON ((-2323155 1886119,...
## 5   5 3 POLYGON ((-2323155 2000293,...
## 6   6 6 POLYGON ((-2323155 2114466,...
## 7   7 1 POLYGON ((-2323155 2228640,...
## 8   8 1 POLYGON ((-2323155 2342813,...
## 9   9 1 POLYGON ((-2323155 2456987,...
## 10 10 1 POLYGON ((-2290196 1714859,...
point_in_polygon(navigation, hex_grid, "id") 
## Simple feature collection with 2271 features and 2 fields
## geometry type:  POLYGON
## dimension:      XY
## bbox:           xmin: -2389073 ymin: 230603 xmax: 2291113 ymax: 3218144
## projected CRS:  NAD83 / Conus Albers
## First 10 features:
##    id n                              x
## 1   1 1 POLYGON ((-2356114 2057379,...
## 2   2 1 POLYGON ((-2356114 2171553,...
## 3   3 1 POLYGON ((-2356114 2285727,...
## 4   4 1 POLYGON ((-2323155 1886119,...
## 5   5 1 POLYGON ((-2323155 2000293,...
## 6   6 1 POLYGON ((-2323155 2114466,...
## 7   7 1 POLYGON ((-2323155 2228640,...
## 8   8 1 POLYGON ((-2323155 2342813,...
## 9   9 1 POLYGON ((-2323155 2456987,...
## 10 10 1 POLYGON ((-2290196 1714859,...
point_in_polygon(debris_control, hex_grid, "id") 
## Simple feature collection with 2271 features and 2 fields
## geometry type:  POLYGON
## dimension:      XY
## bbox:           xmin: -2389073 ymin: 230603 xmax: 2291113 ymax: 3218144
## projected CRS:  NAD83 / Conus Albers
## First 10 features:
##    id n                              x
## 1   1 1 POLYGON ((-2356114 2057379,...
## 2   2 1 POLYGON ((-2356114 2171553,...
## 3   3 1 POLYGON ((-2356114 2285727,...
## 4   4 1 POLYGON ((-2323155 1886119,...
## 5   5 1 POLYGON ((-2323155 2000293,...
## 6   6 1 POLYGON ((-2323155 2114466,...
## 7   7 1 POLYGON ((-2323155 2228640,...
## 8   8 1 POLYGON ((-2323155 2342813,...
## 9   9 1 POLYGON ((-2323155 2456987,...
## 10 10 1 POLYGON ((-2290196 1714859,...
#function for plotting (4.2)
plot_pip_2 = function(data, title){
  ggplot() +
    geom_sf(data = data, aes(fill = log(n)), col = NA) +
    scale_fill_viridis_b() +
    gghighlight::gghighlight(n > mean(n) + sd(n)) + 
    theme_void() +
    labs(title = title,
         caption = paste("Dams:", sum(data$n)))
}
#plotting dam purposes on hexagonal grid tessellation 
point_in_polygon(water_supply, hex_grid, "id") %>%
    plot_pip_2(., "Dam Locations with Water Supply Purpose")

point_in_polygon(recreation, hex_grid, "id") %>%
    plot_pip_2(., "Dam Locations with Recreation Purpose")

point_in_polygon(navigation, hex_grid, "id") %>%
    plot_pip_2(., "Dam Locations with Navigation Purpose")

point_in_polygon(debris_control, hex_grid, "id") %>%
    plot_pip_2(., "Dam Locations with Debris Control Purpose")

#Comment of geographic distribution of dams you found. Does it make sense? How might the tessellation you chose impact your findings? How does the distribution of dams coiencide with other geogaphic factors such as river systems, climate, ect?